import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        component: HomeView,
        redirect: '/admin/index',
        children: [
            // 首页
            {
                path: '/admin/index',
                component: () => import('../views/admin/AdminIndexView.vue')
            },
            // 账号管理
            {
                path: '/admin/account/user',
                component: () => import('../views/admin/account/UserListView.vue')
            },
            {
                path: '/admin/account/user/add-new',
                component: () => import('../views/admin/account/UserAddNewView.vue')
            },
            // 内容管理
            {
                path: '/admin/content/tag-type',
                component: () => import('../views/admin/content/TagTypeListView.vue')
            },
            {
                path: '/admin/content/tag-type/add-new',
                component: () => import('../views/admin/content/TagTypeAddNewView.vue')
            },
            {
                path: '/admin/content/tag',
                component: () => import('../views/admin/content/TagListView.vue')
            },
            {
                path: '/admin/content/tag/add-new',
                component: () => import('../views/admin/content/TagAddNewView.vue')
            },
            {
                path: '/admin/content/category',
                component: () => import('../views/admin/content/CategoryListView.vue')
            },
            {
                path: '/admin/content/category/add-new',
                component: () => import('../views/admin/content/CategoryAddNewView.vue')
            },
            {
                path: '/admin/content/article',
                component: () => import('../views/admin/content/ArticleListView.vue')
            },
            {
                path: '/admin/content/article/add-new',
                component: () => import('../views/admin/content/ArticleAddNewView.vue')
            },
            {
                path: '/admin/content/comment',
                component: () => import('../views/admin/content/CommentListView.vue')
            },
            // 商品管理
            {
                path: '/admin/product/category',
                component: () => import('../views/admin/product/CategoryListView.vue')
            },
            {
                path: '/admin/product/category/add-new',
                component: () => import('../views/admin/product/CategoryAddNewView.vue')
            },
            {
                path: '/admin/product/goods',
                component: () => import('../views/admin/product/GoodsListView.vue')
            },
            {
                path: '/admin/product/goods/add-new',
                component: () => import('../views/admin/product/GoodsAddNewView.vue')
            },
        ]
    },
    {
        path: '/login',
        component: () => import('../views/LoginView.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
